from django.shortcuts import render

from apps.samap.models import ScenicArea


def index(request):
    scenicid = request.GET.get('scenicid')
    if scenicid is None:
        scenic_area = ScenicArea.objects.filter(root=True, is_delete=False).order_by('id').first()
    else:
        scenic_area = ScenicArea.objects.get(pk=scenicid)

    context = {'scenicid': scenic_area.id}
    return render(request, 'index.html', context)
